//
//  SYAddJiLuView.m
//  SanYiTeaching
//
//  Created by 郑浩然 on 2019/4/30.
//  Copyright © 2019年 SanYi. All rights reserved.
//

#import "SYAddJiLuView.h"
#import "SYAddZiJiLuView.h"


@interface SYAddJiLuView ()

@property (strong, nonatomic) SYBackTopView *backView;//顶部viwe
@property (nonatomic, strong) UIButton *addBtn;//添加按钮
@property (strong, nonatomic) SYAddZiJiLuView *zjiluView;//子页面

@end


@implementation SYAddJiLuView
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor colorWithHexString:@"#EEEEEE"];
        [self initSubView];
    }
    return self;
}
- (void)initSubView {
    [self addSubview:self.backView];
    [self.backView mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(self);
        make.height.mas_equalTo(50);
    }];
    [self.backView addSubview:self.addBtn];
    [self.addBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.backView.mas_right).offset(-20);
        make.centerY.equalTo(self.backView.mas_centerY);
        make.width.height.mas_equalTo(40);
    }];
    
    [self addSubview:self.zjiluView];
    [self.zjiluView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.backView.mas_bottom);
        make.left.equalTo(self).offset(14);
        make.bottom.right.equalTo(self).offset(-14);
    }];
}

- (void)chuangAddBtnClick {
    
}

#pragma mark - set
//头部
- (SYBackTopView *)backView {
    if (!_backView) {
        _backView = [[SYBackTopView alloc] initWithTitleName:@"添加记录" baseView:self];
    }
    return _backView;
}
//添加
- (UIButton *)addBtn {
    if (!_addBtn) {
        _addBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_addBtn addTarget:self action:@selector(chuangAddBtnClick) forControlEvents:UIControlEventTouchUpInside];
        _addBtn.titleLabel.font = [UIFont systemFontOfSize:14];
        [_addBtn setTitleColor:SELECTEDCOLOR forState:0];
        [_addBtn setTitle:@"保存" forState:UIControlStateNormal];
    }
    return _addBtn;
}
//添加记录
- (SYAddZiJiLuView *)zjiluView {
    if (!_zjiluView) {
        _zjiluView = [[NSBundle mainBundle] loadNibNamed:@"SYAddZiJiLuView" owner:nil options:nil].firstObject;
    }
    return _zjiluView;
}


@end


















